# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-beetle-psx
pkgver=0.9.44.22
_realname=Matrix
pkgrel=1
pkgdesc="Beetle-PSX for Kodi"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.beetle-psx"
arch="x86 x86_64 aarch64 armv7" # kodi
license="GPL-2.0-or-later"
makedepends="cmake libretro-beetle-psx kodi-dev"
depends="kodi-game-libretro libretro-beetle-psx"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.beetle-psx/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.beetle-psx-$pkgver-$_realname"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi \
		-DUSE_LTO=1
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
	rm -f "$pkgdir"/usr/lib/kodi/addons/game.libretro.beetle-psx/game.libretro.beetle-psx.so
	ln -s /usr/lib/libretro/mednafen_psx_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.beetle-psx/game.libretro.beetle-psx.so
}

sha512sums="d36c7239b161769fa3e9d7274b9d3903355c8ac7ec2f6a3456d2c607acabc0ad3501f86c32656d4e300c84d5eeda7be61c05734a0013ed84146854774c0ad66c  kodi-game-libretro-beetle-psx-0.9.44.22-Matrix.tar.gz"
